﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class PS_RoyalItemRepayDtls : System.Web.UI.Page
    {
        private SsMng ssMng = new SsMng();
        private IRoyalItemRepayBLL reBLL = new RoyalItemRepayBLL();
        private IRoyalItemRepayDetailBLL dtlsBLL = new RoyalItemRepayDetailBLL();

        private RoyalItemRepayInfo reInfo = new RoyalItemRepayInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblParent.Text = Request.QueryString["RepaySeq"].ToString();
                Session["ParentSeq"] = Request.QueryString["RepaySeq"].ToString();
                LoadDataGrid();
            }
        }
        public void LoadDataGrid()
        {
            IList<RoyalItemRepayInfo> Info = dtlsBLL.ListRoyalItemRepayDetails(Convert.ToInt32(lblParent.Text));
            RadGrid1.DataSource = Info;
            RadGrid1.DataBind();
        }
        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int RepaySeq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Sequence"]);
                dtlsBLL.Delete(RepaySeq, ssMng.EmpSeqI);
            }
            LoadDataGrid();            
        }   
    }
}
